home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Pick Me Up / source code / Movie app source / pickmeUp97 / source / scaleDrawRect.cp < prev   
MacBinary  |  1997-06-27  |  4.9 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Fri Jun 27 12:49:53 1997, modified Fri Jun 27 12:49:53 1997, creator 'CWIE', type ASCII, 4295 bytes "scaleDrawRect.cp" , at 0x1147 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 10 73 63 61 6c 65 44 | 72 61 77 52 65 63 74 2e |..scaleD|rawRect.|
|00000010| 63 70 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |cp......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 10 c7 00 | 00 01 ac af d9 9f b1 af |........|........|
|00000060| d9 9f b1 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 68 7f 00 00 |........|....h...|
|00000080| 2f 2f 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |//======|========|
|00000090| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|000000a0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|000000b0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|000000c0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 0d 2f 2f |========|=====.//|
|000000d0| 20 a5 a5 20 20 53 63 61 | 6c 65 44 72 61 77 52 65 | .. Sca|leDrawRe|
|000000e0| 63 74 0d 2f 2f 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |ct.//===|========|
|000000f0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000100| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000110| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000120| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000130| 0d 76 6f 69 64 09 09 09 | 09 09 09 0d 4c 50 69 63 |.void...|....LPic|
|00000140| 74 54 68 75 6d 62 56 69 | 65 77 3a 3a 53 63 61 6c |tThumbVi|ew::Scal|
|00000150| 65 44 72 61 77 52 65 63 | 74 28 09 52 65 63 74 20 |eDrawRec|t(.Rect |
|00000160| 20 69 6e 4f 72 69 67 69 | 6e 61 6c 52 65 63 74 2c | inOrigi|nalRect,|
|00000170| 20 52 65 63 74 20 20 69 | 6e 54 68 75 6d 6e 61 69 | Rect i|nThumnai|
|00000180| 6c 52 65 63 74 2c 0d 09 | 09 09 09 09 09 09 09 09 |lRect,..|........|
|00000190| 09 09 09 52 65 63 74 2a | 20 20 6f 75 74 53 63 61 |...Rect*| outSca|
|000001a0| 6c 65 64 52 65 63 74 29 | 0d 7b 0d 09 2f 2a 0d 09 |ledRect)|.{../*..|
|000001b0| 09 4e 4f 54 45 53 3a 0d | 09 09 54 68 69 73 20 72 |.NOTES:.|..This r|
|000001c0| 6f 75 74 69 6e 65 20 69 | 73 20 66 6f 72 20 73 63 |outine i|s for sc|
|000001d0| 61 6c 69 6e 67 20 74 68 | 65 20 64 72 61 77 52 65 |aling th|e drawRe|
|000001e0| 63 74 20 6f 66 20 61 20 | 70 69 63 74 75 72 65 20 |ct of a |picture |
|000001f0| 74 6f 20 66 69 74 20 69 | 6e 74 6f 0d 09 09 61 20 |to fit i|nto...a |
|00000200| 74 68 75 6d 62 6e 61 69 | 6c 20 73 69 7a 65 64 20 |thumbnai|l sized |
|00000210| 64 72 61 77 69 6e 67 20 | 61 72 65 61 2e 20 20 46 |drawing |area. F|
|00000220| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 69 66 20 79 |or examp|le, if y|
|00000230| 6f 75 20 68 61 76 65 20 | 61 20 70 69 63 74 75 72 |ou have |a pictur|
|00000240| 65 0d 09 09 74 68 61 74 | 20 69 73 20 35 30 30 20 |e...that| is 500 |
|00000250| 78 20 37 30 30 20 70 69 | 78 65 6c 73 2c 20 62 75 |x 700 pi|xels, bu|
|00000260| 74 20 6f 6e 6c 79 20 68 | 61 76 65 20 61 20 37 30 |t only h|ave a 70|
|00000270| 20 78 20 37 30 20 70 69 | 78 65 6c 20 73 69 7a 65 | x 70 pi|xel size|
|00000280| 0d 09 09 61 72 65 61 20 | 69 6e 20 77 68 69 63 68 |...area |in which|
|00000290| 20 74 6f 20 64 72 61 77 | 20 74 68 65 20 69 6d 61 | to draw| the ima|
|000002a0| 67 65 2c 20 74 68 69 73 | 20 72 6f 75 74 69 6e 65 |ge, this| routine|
|000002b0| 20 77 69 6c 6c 20 73 63 | 61 6c 65 0d 09 09 74 68 | will sc|ale...th|
|000002c0| 65 20 70 69 63 74 75 72 | 65 20 64 6f 77 6e 2e 0d |e pictur|e down..|
|000002d0| 09 09 0d 09 09 54 68 69 | 73 20 72 6f 75 74 69 6e |.....Thi|s routin|
|000002e0| 65 20 77 69 6c 6c 20 61 | 6c 73 6f 20 73 63 61 6c |e will a|lso scal|
|000002f0| 65 20 61 20 72 65 63 74 | 28 6f 75 74 53 63 61 6c |e a rect|(outScal|
|00000300| 65 64 52 65 63 74 29 20 | 73 6f 20 74 68 61 74 20 |edRect) |so that |
|00000310| 69 74 20 77 69 6c 6c 20 | 63 65 6e 74 65 72 0d 09 |it will |center..|
|00000320| 09 69 74 73 65 6c 66 20 | 69 6e 20 74 68 65 20 74 |.itself |in the t|
|00000330| 68 75 6d 6e 61 69 6c 2e | 20 20 54 68 69 73 20 77 |humnail.| This w|
|00000340| 61 79 2c 20 74 68 65 20 | 70 69 63 74 75 72 65 20 |ay, the |picture |
|00000350| 74 68 61 74 20 69 73 20 | 73 63 61 6c 65 64 20 64 |that is |scaled d|
|00000360| 6f 77 6e 20 77 69 6c 6c | 0d 09 09 62 65 20 63 65 |own will|...be ce|
|00000370| 6e 74 65 72 65 64 20 77 | 68 65 6e 20 69 74 20 69 |ntered w|hen it i|
|00000380| 73 20 64 72 61 77 6e 20 | 69 6e 20 74 68 65 20 74 |s drawn |in the t|
|00000390| 68 75 6d 62 6e 61 69 6c | 2e 0d 09 09 0d 09 09 57 |humbnail|.......W|
|000003a0| 68 79 20 6f 6e 6c 79 20 | 52 65 63 74 73 3f 0d 09 |hy only |Rects?..|
|000003b0| 09 47 65 6e 65 72 61 6c | 6c 79 20 77 68 65 6e 20 |.General|ly when |
|000003c0| 64 72 61 77 69 6e 67 20 | 70 69 63 74 75 72 65 73 |drawing |pictures|
|000003d0| 2c 20 74 68 65 20 73 79 | 73 74 65 6d 20 72 6f 75 |, the sy|stem rou|
|000003e0| 74 69 6e 65 73 20 74 68 | 61 74 20 64 6f 20 74 68 |tines th|at do th|
|000003f0| 65 20 61 63 74 75 61 6c | 20 0d 09 09 64 72 61 77 |e actual| ...draw|
|00000400| 69 6e 67 20 77 61 6e 74 | 20 61 20 52 65 63 74 20 |ing want| a Rect |
|00000410| 74 6f 20 64 65 66 69 6e | 65 20 74 68 65 20 73 69 |to defin|e the si|
|00000420| 7a 65 20 61 6e 64 20 6c | 6f 63 61 74 69 6f 6e 20 |ze and l|ocation |
|00000430| 6f 66 20 74 68 65 20 70 | 69 63 74 75 72 65 20 69 |of the p|icture i|
|00000440| 6e 20 74 68 65 0d 09 09 | 63 75 72 72 65 6e 74 20 |n the...|current |
|00000450| 47 72 61 66 50 6f 72 74 | 2e 20 20 74 68 61 74 20 |GrafPort|. that |
|00000460| 69 73 20 77 68 79 20 61 | 6c 6c 20 74 68 61 74 20 |is why a|ll that |
|00000470| 69 73 20 6e 65 65 64 65 | 64 20 68 65 72 65 20 69 |is neede|d here i|
|00000480| 73 20 74 6f 20 73 63 61 | 6c 65 20 74 68 65 20 0d |s to sca|le the .|
|00000490| 09 09 72 65 63 74 20 61 | 6e 64 20 74 68 65 6e 20 |..rect a|nd then |
|000004a0| 70 61 73 73 20 6f 75 74 | 53 63 61 6c 65 64 52 65 |pass out|ScaledRe|
|000004b0| 63 74 20 74 6f 20 74 68 | 65 20 64 72 61 77 20 72 |ct to th|e draw r|
|000004c0| 6f 75 74 69 6e 65 2e 0d | 09 09 0d 09 09 52 65 63 |outine..|.....Rec|
|000004d0| 74 09 69 6e 4f 72 69 67 | 69 6e 61 6c 52 65 63 74 |t.inOrig|inalRect|
|000004e0| 3b 20 20 09 49 6e 70 75 | 74 20 74 68 65 20 6f 72 |; .Inpu|t the or|
|000004f0| 69 67 69 6e 61 6c 20 73 | 69 7a 65 20 6f 66 20 74 |iginal s|ize of t|
|00000500| 68 65 20 70 69 63 74 75 | 72 65 27 73 20 72 65 63 |he pictu|re's rec|
|00000510| 74 20 68 65 72 65 2e 0d | 09 09 52 65 63 74 09 69 |t here..|..Rect.i|
|00000520| 6e 54 68 75 6d 62 6e 61 | 69 6c 52 65 63 74 3b 09 |nThumbna|ilRect;.|
|00000530| 49 6e 70 75 74 20 74 68 | 65 20 73 69 7a 65 20 6f |Input th|e size o|
|00000540| 66 20 74 68 65 20 74 68 | 75 6d 6e 61 69 6c 20 77 |f the th|umnail w|
|00000550| 68 65 72 65 20 74 68 65 | 20 70 69 63 74 75 72 65 |here the| picture|
|00000560| 20 69 73 0d 09 09 09 09 | 09 09 09 09 09 73 75 70 | is.....|.....sup|
|00000570| 70 6f 73 65 64 20 74 6f | 20 62 65 20 64 72 61 77 |posed to| be draw|
|00000580| 6e 20 68 65 72 65 2e 0d | 09 09 52 65 63 74 2a 09 |n here..|..Rect*.|
|00000590| 6f 75 74 53 63 61 6c 65 | 64 52 65 63 74 3b 09 09 |outScale|dRect;..|
|000005a0| 54 68 69 73 20 69 73 20 | 77 68 65 72 65 20 74 68 |This is |where th|
|000005b0| 65 20 73 63 61 6c 65 64 | 20 72 65 63 74 20 66 6f |e scaled| rect fo|
|000005c0| 72 20 74 68 65 20 70 69 | 63 74 75 72 65 0d 09 09 |r the pi|cture...|
|000005d0| 09 09 09 09 09 09 09 77 | 69 6c 6c 20 62 65 20 70 |.......w|ill be p|
|000005e0| 61 73 73 65 64 20 62 61 | 63 6b 20 74 6f 20 79 6f |assed ba|ck to yo|
|000005f0| 75 2e 0d 09 09 09 09 09 | 09 09 09 09 0d 09 0d 09 |u.......|........|
|00000600| 0d 09 2a 2f 0d 09 73 68 | 6f 72 74 09 70 65 72 63 |..*/..sh|ort.perc|
|00000610| 65 6e 74 20 3d 20 30 3b | 0d 09 3a 3a 49 6e 73 65 |ent = 0;|..::Inse|
|00000620| 74 52 65 63 74 28 26 69 | 6e 54 68 75 6d 6e 61 69 |tRect(&i|nThumnai|
|00000630| 6c 52 65 63 74 2c 20 31 | 2c 31 29 3b 0d 09 0d 09 |lRect, 1|,1);....|
|00000640| 2f 2f 20 20 47 65 74 74 | 69 6e 67 20 74 68 65 20 |// Gett|ing the |
|00000650| 68 20 61 6e 64 20 77 20 | 6f 66 20 74 68 65 20 6f |h and w |of the o|
|00000660| 72 69 67 20 70 69 63 73 | 20 66 72 61 6d 65 20 73 |rig pics| frame s|
|00000670| 69 7a 65 2e 0d 09 73 68 | 6f 72 74 20 77 20 3d 20 |ize...sh|ort w = |
|00000680| 69 6e 4f 72 69 67 69 6e | 61 6c 52 65 63 74 2e 72 |inOrigin|alRect.r|
|00000690| 69 67 68 74 20 2d 20 69 | 6e 4f 72 69 67 69 6e 61 |ight - i|nOrigina|
|000006a0| 6c 52 65 63 74 2e 6c 65 | 66 74 3b 0d 09 73 68 6f |lRect.le|ft;..sho|
|000006b0| 72 74 20 68 20 3d 20 69 | 6e 4f 72 69 67 69 6e 61 |rt h = i|nOrigina|
|000006c0| 6c 52 65 63 74 2e 62 6f | 74 74 6f 6d 20 2d 20 69 |lRect.bo|ttom - i|
|000006d0| 6e 4f 72 69 67 69 6e 61 | 6c 52 65 63 74 2e 74 6f |nOrigina|lRect.to|
|000006e0| 70 3b 0d 09 09 09 0d 09 | 2f 2f 20 20 47 65 74 74 |p;......|// Gett|
|000006f0| 69 6e 67 20 74 68 65 20 | 68 20 61 6e 64 20 77 20 |ing the |h and w |
|00000700| 6f 66 20 74 68 65 20 74 | 68 75 6d 62 73 20 66 72 |of the t|humbs fr|
|00000710| 61 6d 65 20 73 69 7a 65 | 2e 0d 09 73 68 6f 72 74 |ame size|...short|
|00000720| 20 41 77 20 3d 20 69 6e | 54 68 75 6d 6e 61 69 6c | Aw = in|Thumnail|
|00000730| 52 65 63 74 2e 72 69 67 | 68 74 20 2d 20 69 6e 54 |Rect.rig|ht - inT|
|00000740| 68 75 6d 6e 61 69 6c 52 | 65 63 74 2e 6c 65 66 74 |humnailR|ect.left|
|00000750| 3b 0d 09 73 68 6f 72 74 | 20 41 68 20 3d 20 69 6e |;..short| Ah = in|
|00000760| 54 68 75 6d 6e 61 69 6c | 52 65 63 74 2e 62 6f 74 |Thumnail|Rect.bot|
|00000770| 74 6f 6d 20 2d 20 69 6e | 54 68 75 6d 6e 61 69 6c |tom - in|Thumnail|
|00000780| 52 65 63 74 2e 74 6f 70 | 3b 0d 09 09 09 0d 09 2f |Rect.top|;....../|
|00000790| 2f 20 20 43 6f 6d 70 61 | 72 69 6e 67 20 77 68 69 |/ Compa|ring whi|
|000007a0| 63 68 20 69 73 20 62 69 | 67 67 65 72 20 77 69 74 |ch is bi|gger wit|
|000007b0| 68 20 74 68 65 20 6f 72 | 69 67 20 70 69 63 73 0d |h the or|ig pics.|
|000007c0| 09 2f 2f 20 20 57 68 79 | 20 64 6f 20 77 65 20 68 |.// Why| do we h|
|000007d0| 61 76 65 20 74 6f 20 63 | 6f 6d 70 61 72 65 3f 20 |ave to c|ompare? |
|000007e0| 20 49 6e 20 6f 72 64 65 | 72 20 74 6f 20 73 63 61 | In orde|r to sca|
|000007f0| 6c 65 20 74 68 65 20 70 | 69 63 74 75 72 65 2c 20 |le the p|icture, |
|00000800| 77 65 0d 09 2f 2f 20 20 | 6e 65 65 64 20 74 6f 20 |we..// |need to |
|00000810| 6b 6e 6f 77 20 77 68 69 | 63 68 20 73 69 64 65 20 |know whi|ch side |
|00000820| 69 73 20 62 69 67 67 65 | 72 2e 20 20 54 68 61 74 |is bigge|r. That|
|00000830| 20 77 61 79 2c 20 64 65 | 70 65 6e 64 69 6e 67 20 | way, de|pending |
|00000840| 6f 6e 20 0d 09 2f 2f 20 | 20 77 68 69 63 68 20 6f |on ..// | which o|
|00000850| 6e 65 20 69 73 20 62 69 | 67 67 65 72 2c 20 74 68 |ne is bi|gger, th|
|00000860| 65 20 62 69 67 67 65 72 | 20 73 69 64 65 20 77 69 |e bigger| side wi|
|00000870| 6c 6c 20 62 65 20 74 68 | 65 20 66 75 6c 6c 20 73 |ll be th|e full s|
|00000880| 69 7a 65 0d 09 2f 2f 20 | 20 6f 66 20 74 68 65 20 |ize..// | of the |
|00000890| 74 68 75 6d 62 6e 61 69 | 6c 20 77 69 6e 64 6f 77 |thumbnai|l window|
|000008a0| 2c 20 61 6e 64 20 74 68 | 65 6e 20 77 65 27 6c 6c |, and th|en we'll|
|000008b0| 20 73 63 61 6c 65 20 74 | 68 65 20 6f 74 68 65 72 | scale t|he other|
|000008c0| 0d 09 2f 2f 20 20 73 69 | 64 65 20 64 6f 77 6e 20 |..// si|de down |
|000008d0| 74 6f 20 6d 61 74 63 68 | 20 74 68 65 20 6f 74 68 |to match| the oth|
|000008e0| 65 72 20 73 69 64 65 2e | 0d 09 69 66 28 77 20 3e |er side.|..if(w >|
|000008f0| 20 68 29 0d 09 7b 0d 09 | 09 2f 2f 20 20 53 69 6e | h)..{..|.// Sin|
|00000900| 63 65 20 74 68 65 20 77 | 69 64 74 68 20 69 73 20 |ce the w|idth is |
|00000910| 6c 61 72 67 65 72 20 74 | 68 61 6e 20 74 68 65 20 |larger t|han the |
|00000920| 68 65 69 67 68 74 2c 20 | 77 65 20 61 72 65 20 68 |height, |we are h|
|00000930| 65 72 65 2e 0d 09 09 09 | 09 0d 09 09 2f 2f 20 20 |ere.....|....// |
|00000940| 57 65 20 66 69 72 73 74 | 20 73 65 74 20 74 68 65 |We first| set the|
|00000950| 20 6c 65 66 74 20 6f 66 | 20 69 6e 4f 72 69 67 69 | left of| inOrigi|
|00000960| 6e 61 6c 52 65 63 74 20 | 74 6f 20 69 6e 54 68 75 |nalRect |to inThu|
|00000970| 6d 62 6e 61 69 6c 52 65 | 63 74 73 20 6c 65 66 74 |mbnailRe|cts left|
|00000980| 2c 20 0d 09 09 2f 2f 20 | 20 70 6c 75 73 20 73 6f |, ...// | plus so|
|00000990| 6d 65 20 6f 66 66 73 65 | 74 2e 20 20 69 6e 54 68 |me offse|t. inTh|
|000009a0| 75 6d 6e 61 69 6c 52 65 | 63 74 20 77 61 73 20 69 |umnailRe|ct was i|
|000009b0| 6e 73 65 74 20 62 79 20 | 31 2c 20 61 6e 64 20 74 |nset by |1, and t|
|000009c0| 68 65 20 6f 66 66 73 65 | 74 0d 09 09 2f 2f 20 20 |he offse|t...// |
|000009d0| 69 73 20 6a 75 73 74 20 | 66 6f 75 6e 64 20 62 79 |is just |found by|
|000009e0| 20 65 78 70 65 72 69 6d | 65 6e 74 69 6e 67 2e 0d | experim|enting..|
|000009f0| 09 09 69 6e 4f 72 69 67 | 69 6e 61 6c 52 65 63 74 |..inOrig|inalRect|
|00000a00| 2e 6c 65 66 74 20 3d 20 | 69 6e 54 68 75 6d 6e 61 |.left = |inThumna|
|00000a10| 69 6c 52 65 63 74 2e 6c | 65 66 74 20 2b 20 31 3b |ilRect.l|eft + 1;|
|00000a20| 0d 09 09 09 09 0d 09 09 | 2f 2f 20 20 53 69 6e 63 |........|// Sinc|
|00000a30| 65 20 74 68 65 20 77 69 | 64 74 68 20 69 73 20 62 |e the wi|dth is b|
|00000a40| 69 67 67 65 72 20 74 68 | 61 6e 20 74 68 65 20 68 |igger th|an the h|
|00000a50| 65 69 67 68 74 2c 20 77 | 65 20 73 65 74 20 74 68 |eight, w|e set th|
|00000a60| 65 20 0d 09 09 2f 2f 20 | 20 77 69 64 74 68 20 74 |e ...// | width t|
|00000a70| 6f 20 62 65 20 74 68 65 | 20 73 69 7a 65 20 6f 66 |o be the| size of|
|00000a80| 20 69 6e 54 68 75 6d 6e | 61 69 6c 52 65 63 74 73 | inThumn|ailRects|
|00000a90| 20 77 69 64 74 68 2e 20 | 20 54 68 61 74 20 77 61 | width. | That wa|
|00000aa0| 79 20 74 68 65 0d 09 09 | 2f 2f 20 20 65 6e 74 69 |y the...|// enti|
|00000ab0| 72 65 20 77 69 64 74 68 | 20 77 69 6c 6c 20 66 69 |re width| will fi|
|00000ac0| 74 20 69 6e 74 6f 20 74 | 68 65 20 74 68 75 6d 62 |t into t|he thumb|
|00000ad0| 6e 61 69 6c 20 72 65 63 | 74 2e 0d 09 09 69 6e 4f |nail rec|t....inO|
|00000ae0| 72 69 67 69 6e 61 6c 52 | 65 63 74 2e 72 69 67 68 |riginalR|ect.righ|
|00000af0| 74 20 3d 20 41 77 3b 0d | 09 09 09 09 0d 09 09 2f |t = Aw;.|......./|
|00000b00| 2f 20 20 4e 6f 77 20 77 | 65 20 6e 65 65 64 20 74 |/ Now w|e need t|
|00000b10| 6f 20 6b 6e 6f 77 20 77 | 68 61 74 20 70 65 72 63 |o know w|hat perc|
|00000b20| 65 6e 74 61 67 65 20 74 | 68 65 20 69 6d 61 67 65 |entage t|he image|
|00000b30| 20 77 61 73 20 73 63 61 | 6c 65 64 20 64 6f 77 6e | was sca|led down|
|00000b40| 2e 20 0d 09 09 2f 2f 20 | 20 57 65 20 6e 65 65 64 |. ...// | We need|
|00000b50| 20 74 6f 20 6b 6e 6f 77 | 20 74 68 69 73 20 62 65 | to know| this be|
|00000b60| 63 61 75 73 65 20 77 65 | 20 6e 65 65 64 20 74 6f |cause we| need to|
|00000b70| 20 73 63 61 6c 65 20 74 | 68 65 20 6f 74 68 65 72 | scale t|he other|
|00000b80| 20 73 69 64 65 0d 09 09 | 2f 2f 20 20 6a 75 73 74 | side...|// just|
|00000b90| 20 61 73 20 6d 75 63 68 | 20 61 73 20 77 65 20 73 | as much| as we s|
|00000ba0| 63 61 6c 65 64 20 74 68 | 65 20 74 68 65 20 77 69 |caled th|e the wi|
|00000bb0| 64 74 68 2e 0d 09 09 70 | 65 72 63 65 6e 74 20 3d |dth....p|ercent =|
|00000bc0| 20 28 28 41 77 20 2a 20 | 31 30 30 29 2f 77 29 3b | ((Aw * |100)/w);|
|00000bd0| 0d 09 09 09 09 0d 09 09 | 2f 2f 20 20 4e 6f 77 20 |........|// Now |
|00000be0| 77 65 20 74 61 6b 65 20 | 74 68 65 20 70 65 72 63 |we take |the perc|
|00000bf0| 65 6e 74 20 61 6e 64 20 | 64 65 74 65 72 6d 69 6e |ent and |determin|
|00000c00| 65 20 61 20 70 69 78 65 | 6c 20 61 6d 6f 75 6e 74 |e a pixe|l amount|
|00000c10| 20 62 61 73 65 64 20 6f | 6e 20 74 68 65 0d 09 09 | based o|n the...|
|00000c20| 2f 2f 20 20 70 65 72 63 | 65 6e 74 61 67 65 20 77 |// perc|entage w|
|00000c30| 65 20 73 63 61 6c 65 64 | 2e 0d 09 09 69 6e 4f 72 |e scaled|....inOr|
|00000c40| 69 67 69 6e 61 6c 52 65 | 63 74 2e 62 6f 74 74 6f |iginalRe|ct.botto|
|00000c50| 6d 20 3d 20 28 28 70 65 | 72 63 65 6e 74 20 2a 20 |m = ((pe|rcent * |
|00000c60| 68 29 2f 31 30 30 29 3b | 0d 09 09 09 09 0d 09 09 |h)/100);|........|
|00000c70| 2f 2f 20 20 4e 6f 77 20 | 77 65 20 6e 65 65 64 20 |// Now |we need |
|00000c80| 74 6f 20 63 65 6e 74 65 | 72 20 74 68 65 20 6e 65 |to cente|r the ne|
|00000c90| 77 6c 79 20 73 63 61 6c | 65 64 20 72 65 63 74 20 |wly scal|ed rect |
|00000ca0| 69 6e 20 74 68 65 20 74 | 68 75 6d 62 6e 61 69 6c |in the t|humbnail|
|00000cb0| 0d 09 09 2f 2f 20 20 72 | 65 63 74 2e 20 20 49 66 |...// r|ect. If|
|00000cc0| 20 77 65 20 64 69 64 6e | 27 74 20 64 6f 20 74 68 | we didn|'t do th|
|00000cd0| 69 73 2c 20 74 68 65 6e | 20 74 68 65 20 75 70 70 |is, then| the upp|
|00000ce0| 65 72 20 6c 65 66 74 20 | 63 6f 72 6e 65 72 20 6f |er left |corner o|
|00000cf0| 66 20 74 68 65 0d 09 09 | 2f 2f 20 20 69 6d 61 67 |f the...|// imag|
|00000d00| 65 20 77 6f 75 6c 64 20 | 62 65 20 61 74 20 74 68 |e would |be at th|
|00000d10| 65 20 75 70 70 65 72 20 | 6c 65 66 74 20 63 6f 72 |e upper |left cor|
|00000d20| 6e 65 72 20 6f 66 20 74 | 68 65 20 74 68 75 6d 62 |ner of t|he thumb|
|00000d30| 6e 61 69 6c 2e 20 20 57 | 65 20 77 61 6e 74 0d 09 |nail. W|e want..|
|00000d40| 09 2f 2f 20 20 74 68 65 | 20 69 6d 61 67 65 20 74 |.// the| image t|
|00000d50| 6f 20 62 65 20 69 6e 20 | 74 68 65 20 6d 69 64 64 |o be in |the midd|
|00000d60| 6c 65 20 6f 66 20 74 68 | 65 20 74 68 75 6d 62 6e |le of th|e thumbn|
|00000d70| 61 69 6c 20 73 6f 20 77 | 65 20 6b 6c 75 67 65 20 |ail so w|e kluge |
|00000d80| 68 65 72 65 2e 0d 09 09 | 69 6e 4f 72 69 67 69 6e |here....|inOrigin|
|00000d90| 61 6c 52 65 63 74 2e 74 | 6f 70 20 3d 20 28 28 41 |alRect.t|op = ((A|
|00000da0| 68 20 2d 20 69 6e 4f 72 | 69 67 69 6e 61 6c 52 65 |h - inOr|iginalRe|
|00000db0| 63 74 2e 62 6f 74 74 6f | 6d 29 2f 32 29 3b 0d 09 |ct.botto|m)/2);..|
|00000dc0| 09 09 09 0d 09 09 2f 2f | 20 20 4a 75 73 74 20 73 |......//| Just s|
|00000dd0| 6f 6d 65 20 66 75 64 67 | 69 6e 67 20 74 6f 20 67 |ome fudg|ing to g|
|00000de0| 65 74 20 74 68 65 20 63 | 65 6e 74 65 72 69 6e 67 |et the c|entering|
|00000df0| 20 6a 75 73 74 20 72 69 | 67 68 74 2e 20 20 54 68 | just ri|ght. Th|
|00000e00| 69 73 20 69 73 20 66 6f | 75 6e 64 0d 09 09 2f 2f |is is fo|und...//|
|00000e10| 20 20 77 69 74 68 20 65 | 78 70 65 72 69 6d 65 6e | with e|xperimen|
|00000e20| 74 61 74 69 6f 6e 2e 0d | 09 09 69 6e 4f 72 69 67 |tation..|..inOrig|
|00000e30| 69 6e 61 6c 52 65 63 74 | 2e 74 6f 70 20 2b 3d 20 |inalRect|.top += |
|00000e40| 31 3b 0d 09 09 09 09 0d | 09 09 2f 2f 20 20 53 69 |1;......|..// Si|
|00000e50| 6e 63 65 20 77 65 20 6a | 75 73 74 20 63 6f 6c 6c |nce we j|ust coll|
|00000e60| 61 70 73 65 64 20 74 68 | 65 20 72 65 63 74 2c 20 |apsed th|e rect, |
|00000e70| 74 6f 70 20 64 6f 77 6e | 2c 20 77 65 20 6e 65 65 |top down|, we nee|
|00000e80| 64 20 74 6f 20 65 78 70 | 61 6e 64 20 74 68 65 20 |d to exp|and the |
|00000e90| 0d 09 09 2f 2f 20 20 62 | 6f 74 74 6f 6d 20 6f 66 |...// b|ottom of|
|00000ea0| 20 74 68 65 20 72 65 63 | 74 20 61 73 20 6d 75 63 | the rec|t as muc|
|00000eb0| 68 20 61 73 20 77 65 20 | 63 6f 6c 6c 61 70 73 65 |h as we |collapse|
|00000ec0| 64 20 69 74 20 66 72 6f | 6d 20 74 6f 70 2e 0d 09 |d it fro|m top...|
|00000ed0| 09 69 6e 4f 72 69 67 69 | 6e 61 6c 52 65 63 74 2e |.inOrigi|nalRect.|
|00000ee0| 62 6f 74 74 6f 6d 20 2b | 3d 20 69 6e 4f 72 69 67 |bottom +|= inOrig|
|00000ef0| 69 6e 61 6c 52 65 63 74 | 2e 74 6f 70 3b 0d 09 09 |inalRect|.top;...|
|00000f00| 09 09 0d 09 09 09 09 0d | 09 7d 65 6c 73 65 20 69 |........|.}else i|
|00000f10| 66 28 77 20 3c 20 68 29 | 0d 09 09 7b 0d 09 09 09 |f(w < h)|...{....|
|00000f20| 09 09 0d 09 09 09 69 6e | 4f 72 69 67 69 6e 61 6c |......in|Original|
|00000f30| 52 65 63 74 2e 74 6f 70 | 20 3d 20 69 6e 54 68 75 |Rect.top| = inThu|
|00000f40| 6d 6e 61 69 6c 52 65 63 | 74 2e 74 6f 70 20 2b 20 |mnailRec|t.top + |
|00000f50| 31 3b 0d 09 09 09 69 6e | 4f 72 69 67 69 6e 61 6c |1;....in|Original|
|00000f60| 52 65 63 74 2e 62 6f 74 | 74 6f 6d 20 3d 20 41 68 |Rect.bot|tom = Ah|
|00000f70| 3b 0d 09 09 09 70 65 72 | 63 65 6e 74 20 3d 20 28 |;....per|cent = (|
|00000f80| 28 41 68 20 2a 20 31 30 | 30 29 2f 68 29 3b 0d 09 |(Ah * 10|0)/h);..|
|00000f90| 09 09 09 09 0d 09 09 09 | 69 6e 4f 72 69 67 69 6e |........|inOrigin|
|00000fa0| 61 6c 52 65 63 74 2e 72 | 69 67 68 74 20 3d 20 28 |alRect.r|ight = (|
|00000fb0| 28 70 65 72 63 65 6e 74 | 20 2a 20 77 29 2f 31 30 |(percent| * w)/10|
|00000fc0| 30 29 3b 0d 09 09 09 69 | 6e 4f 72 69 67 69 6e 61 |0);....i|nOrigina|
|00000fd0| 6c 52 65 63 74 2e 6c 65 | 66 74 20 3d 20 28 28 41 |lRect.le|ft = ((A|
|00000fe0| 77 20 2d 20 69 6e 4f 72 | 69 67 69 6e 61 6c 52 65 |w - inOr|iginalRe|
|00000ff0| 63 74 2e 72 69 67 68 74 | 29 2f 32 29 3b 0d 09 09 |ct.right|)/2);...|
|00001000| 09 69 6e 4f 72 69 67 69 | 6e 61 6c 52 65 63 74 2e |.inOrigi|nalRect.|
|00001010| 6c 65 66 74 20 2b 3d 20 | 32 3b 0d 09 09 09 69 6e |left += |2;....in|
|00001020| 4f 72 69 67 69 6e 61 6c | 52 65 63 74 2e 72 69 67 |Original|Rect.rig|
|00001030| 68 74 20 2b 3d 20 69 6e | 4f 72 69 67 69 6e 61 6c |ht += in|Original|
|00001040| 52 65 63 74 2e 6c 65 66 | 74 3b 0d 09 09 7d 65 6c |Rect.lef|t;...}el|
|00001050| 73 65 20 69 66 28 77 20 | 3d 3d 20 68 29 0d 09 09 |se if(w |== h)...|
|00001060| 09 7b 0d 09 09 09 09 49 | 6e 73 65 74 52 65 63 74 |.{.....I|nsetRect|
|00001070| 28 26 69 6e 54 68 75 6d | 6e 61 69 6c 52 65 63 74 |(&inThum|nailRect|
|00001080| 2c 20 31 2c 31 29 3b 0d | 09 09 09 09 69 6e 4f 72 |, 1,1);.|....inOr|
|00001090| 69 67 69 6e 61 6c 52 65 | 63 74 20 3d 20 69 6e 54 |iginalRe|ct = inT|
|000010a0| 68 75 6d 6e 61 69 6c 52 | 65 63 74 3b 0d 09 09 09 |humnailR|ect;....|
|000010b0| 09 09 0d 09 09 09 7d 0d | 09 09 09 0d 09 09 2f 2f |......}.|......//|
|000010c0| 20 20 4e 6f 77 20 70 61 | 73 73 69 6e 67 20 74 68 | Now pa|ssing th|
|000010d0| 65 20 73 63 61 6c 65 64 | 20 72 65 63 74 20 62 61 |e scaled| rect ba|
|000010e0| 63 6b 20 69 6e 74 6f 20 | 6f 75 74 53 63 61 6c 65 |ck into |outScale|
|000010f0| 64 52 65 63 74 0d 09 09 | 3a 3a 42 6c 6f 63 6b 4d |dRect...|::BlockM|
|00001100| 6f 76 65 44 61 74 61 28 | 26 69 6e 4f 72 69 67 69 |oveData(|&inOrigi|
|00001110| 6e 61 6c 52 65 63 74 2c | 20 6f 75 74 53 63 61 6c |nalRect,| outScal|
|00001120| 65 64 52 65 63 74 2c 20 | 73 69 7a 65 6f 66 28 52 |edRect, |sizeof(R|
|00001130| 65 63 74 29 29 3b 0d 09 | 09 72 65 74 75 72 6e 3b |ect));..|.return;|
|00001140| 0d 0d 0d 0d 0d 7d 0d 00 | 00 00 00 00 00 00 00 00 |.....}..|........|
|00001150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001180| 00 00 01 00 00 00 01 5a | 00 00 00 5a 00 00 00 52 |.......Z|...Z...R|
|00001190| 00 00 1d 37 10 43 55 46 | 69 6c 65 44 65 73 63 72 |...7.CUF|ileDescr|
|000011a0| 69 70 74 2e 68 00 00 00 | 00 00 00 00 00 00 00 00 |ipt.h...|........|
|000011b0| 10 73 63 61 6c 65 44 72 | 61 77 52 65 63 74 2e 63 |.scaleDr|awRect.c|
|000011c0| 70 65 02 00 00 00 54 45 | 58 54 43 57 49 45 01 00 |pe....TE|XTCWIE..|
|000011d0| 00 00 54 45 58 54 43 57 | 49 45 01 00 ff ff ff ff |..TEXTCW|IE......|
|000011e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011f0| 00 00 af d9 59 75 00 00 | 10 c7 00 00 01 ac 00 00 |....Yu..|........|
|00001200| 00 00 00 00 00 00 00 00 | 00 00 0d a1 25 00 00 00 |........|....%...|
|00001210| 1d 95 08 4d 79 48 61 63 | 6b 39 37 00 00 00 00 00 |...MyHac|k97.....|
|00001220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001230| 00 00 00 00 0a 29 25 00 | 00 00 1d 95 0a 4d 79 48 |.....)%.|.....MyH|
|00001240| 61 63 6b 39 37 2e b5 00 | 00 00 00 00 00 00 00 00 |ack97...|........|
|00001250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 09 e5 |........|........|
|00001260| 25 00 00 00 1d 95 17 4d | 79 50 50 5f 44 65 62 75 |%......M|yPP_Debu|
|00001270| 67 48 65 61 64 65 72 73 | 2e 70 63 68 2b 2b 00 00 |gHeaders|.pch++..|
|00001280| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00001290| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012a0| 00 00 00 00 00 00 00 03 | 00 04 00 3e 00 0d 02 43 |........|...>...C|
|000012b0| 02 63 00 3e 00 0d 02 43 | 02 63 af d9 83 c7 00 00 |.c.>...C|.c......|
|000012c0| 00 00 00 00 10 c7 00 00 | 06 2c 01 00 00 00 00 02 |........|.,......|
|000012d0| 00 00 00 00 00 04 00 01 | 00 01 00 00 01 00 00 00 |........|........|
|000012e0| 01 5a 00 00 00 5a 00 00 | 00 52 01 93 30 3c 1a 14 |.Z...Z..|.R..0<..|
|000012f0| 00 00 00 1c 00 52 00 01 | 4d 50 53 52 00 01 00 12 |.....R..|MPSR....|
|00001300| 4d 57 42 42 00 00 00 2a | 03 ed ff ff 00 00 00 00 |MWBB...*|........|
|00001310| 00 00 00 00 03 ef ff ff | 00 00 00 4c 00 00 00 00 |........|...L....|
|00001320| 03 f0 ff ff 00 00 00 52 | 00 00 00 00 00 00 00 00 |.......R|........|
|00001330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+